# 1.导包
import requests

# 2.确定url
url = 'https://movie.douban.com/top250'

# 3.伪装
head = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
}

# 4.发送请求
response = requests.get(url,headers=head)

#将得到的内容保存到文件中
with open("douban.html","w",encoding="UTF-8") as f:
    f.write(response.text)

